﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Candidate.aspx.cs" Inherits="ResumeProvider.Model.Candidate" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Candidate!</title>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <h2>
            Site For Consultant:
            <asp:HyperLink ID="HyperLinkSiteName" ForeColor="Brown" runat="server"></asp:HyperLink>
        </h2>
        <p>
            Manage the candidate registered with you :
            <asp:LinkButton ID="btnEdit" runat="server" Text="Edit Candidate List" OnClick="btnEdit_Click"></asp:LinkButton>
        </p>
        <asp:GridView ID="GridViewCandidate" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None"
            BorderWidth="1px" CellPadding="3" DataSourceID="LinqDataSourceCandidate" GridLines="Horizontal">
            <AlternatingRowStyle BackColor="#F7F7F7" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="candidateid" HeaderText="candidateid" ReadOnly="True"
                    SortExpression="candidateid" />
                <asp:TemplateField HeaderText="username" SortExpression="username">
                    <ItemTemplate>
                        <input type="button" id="btnShowDetails" value='<%# Eval("username") %>' onclick='<%# string.Format("OpenFormView(this,\"{0}\");", Eval("candidateid")) %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("username") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="firstname" HeaderText="firstname" ReadOnly="True" SortExpression="firstname" />
                <asp:BoundField DataField="lastname" HeaderText="lastname" ReadOnly="True" SortExpression="lastname" />
                <asp:BoundField DataField="address" HeaderText="address" ReadOnly="True" SortExpression="address" />
                <asp:BoundField DataField="email" HeaderText="email" ReadOnly="True" SortExpression="email" />
                <asp:BoundField DataField="mobile" HeaderText="mobile" ReadOnly="True" SortExpression="mobile" />
                <asp:TemplateField HeaderText="consultantid" SortExpression="consultantid">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("consultant.consultantname") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("consultantid") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
            <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
            <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
            <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
            <SortedAscendingCellStyle BackColor="#F4F4FD" />
            <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
            <SortedDescendingCellStyle BackColor="#D8D8F0" />
            <SortedDescendingHeaderStyle BackColor="#3E3277" />
        </asp:GridView>
        <div id="formView" style="width: 300px; border: 1px solid silver; display: none; background-color:White;">
            <table style="width: 100%">
                <tr>
                    <td>
                        SKILLS !!
                    </td>
                    <td style="text-align: right">
                        <input type="button" value="close" onclick="$('#formView').hide();" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div id="skillDetail">
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <script type="text/javascript">
            function OpenFormView(sender, args) {
                var cell = sender.parentNode;

                var f = $("#formView").show();
                $(cell).append($("#formView"));


                var url = "/Model/Skill.aspx?consultantid=" + $("#consultantid").html() + "&candidateid=" + args;
                // $("#skillDetail").load(url + " #skillDetail", DoFailCheck);
                $.ajax({
                    url: url,
                    cache: false,
                    success: Fh
                });

            }
            function Fh(h) {

                $("#skillDetail").html(h);


            }
           
        </script>
        <asp:HiddenField ID="consultantid" Value="1" runat="server" />
        <asp:HiddenField ID="candidateid" Value="1" runat="server" />
        <br />
        <asp:LinqDataSource ID="LinqDataSourceCandidate" runat="server" ContextTypeName="Web.CandidateSkillDataDataContext"
            EntityTypeName="" Select="new (candidateid, username, firstname, lastname, address, email, mobile, consultantid, candidate_skills, consultant)"
            TableName="candidates" Where="consultantid == @consultantid">
            <WhereParameters>
                <asp:ControlParameter ControlID="consultantid" DefaultValue="1" Name="consultantid"
                    PropertyName="Value" Type="Int32" />
            </WhereParameters>
        </asp:LinqDataSource>
        <asp:LinqDataSource ID="LinqDataSourceSkillMaster" runat="server" ContextTypeName="Web.CandidateSkillDataDataContext"
            EntityTypeName="" Select="new (skillid, skillname, skillfamily, candidate_skills)"
            TableName="skillmasters">
        </asp:LinqDataSource>
        <asp:LinqDataSource ID="LinqDataSourceCandidateSkill" runat="server" ContextTypeName="Web.CandidateSkillDataDataContext"
            EntityTypeName="" Select="new (candidateid, skillid, totalmonths, lastused, candidate, skillmaster)"
            TableName="candidate_skills" EnableDelete="True" EnableInsert="True" EnableUpdate="True"
            Where="candidateid == @candidateid">
            <WhereParameters>
                <asp:ControlParameter ControlID="candidateid" DefaultValue="1" Name="candidateid"
                    PropertyName="Value" Type="Int64" />
            </WhereParameters>
        </asp:LinqDataSource>
        <asp:LinqDataSource ID="LinqDataSourceConsultant" runat="server" ContextTypeName="Web.CandidateSkillDataDataContext"
            EntityTypeName="" Select="new (consultantid, consultantname, candidates)" TableName="consultants"
            OnSelected="LinqDataSourceConsultant_Selected">
        </asp:LinqDataSource>
        <asp:LinqDataSource ID="LinqDataSourceCandidateEdit" runat="server" ContextTypeName="Web.CandidateSkillDataDataContext"
            EntityTypeName="" Select="new (candidateid, username, firstname, lastname, address, email, mobile, consultantid, candidate_skills, consultant)"
            TableName="candidates">
        </asp:LinqDataSource>
    </div>
    </form>
</body>
</html>
